package com.archstoday.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.archstoday.R;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * 要闻列表适配器
 */
public class SchemeDetailImageAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    Context mContext;
    List<String> dataInfos;

    public SchemeDetailImageAdapter(List<String> items, Context context) {
        super(R.layout.item_scheme_image, items);
        this.mContext = context;
        this.dataInfos = items;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item, int position) {
        if (item == null) {
            return;
        }

        helper.addOnClickListener(R.id.item_right_img);

        ImageView ivGoodIcon = helper.getView(R.id.item_right_img);
        if (ivGoodIcon != null) {
            Glide.with(mContext).load(item).placeholder(R.mipmap.icon_backgroud).error(R.mipmap.icon_backgroud).dontTransform().into(ivGoodIcon);
        }
    }
}
